package com.agritech.environment;

/**
 * 环境数据类
 * 用于存储和传递环境监测数据
 */
public class EnvironmentData {
    private double soilMoisture; // 土壤湿度(%)
    private double soilPH; // 土壤pH值
    private double soilNutrient; // 土壤养分含量
    private double temperature; // 温度(摄氏度)
    private double humidity; // 空气湿度(%)
    private double windSpeed; // 风速(米/秒)
    private String cropStatus; // 作物生长状态
    private String dataSource; // 数据来源
    private long timestamp; // 数据时间戳

    public EnvironmentData() {
        this.timestamp = System.currentTimeMillis();
    }

    // Getters and Setters
    public double getSoilMoisture() {
        return soilMoisture;
    }

    public void setSoilMoisture(double soilMoisture) {
        this.soilMoisture = soilMoisture;
    }

    public double getSoilPH() {
        return soilPH;
    }

    public void setSoilPH(double soilPH) {
        this.soilPH = soilPH;
    }

    public double getSoilNutrient() {
        return soilNutrient;
    }

    public void setSoilNutrient(double soilNutrient) {
        this.soilNutrient = soilNutrient;
    }

    public double getTemperature() {
        return temperature;
    }

    public void setTemperature(double temperature) {
        this.temperature = temperature;
    }

    public double getHumidity() {
        return humidity;
    }

    public void setHumidity(double humidity) {
        this.humidity = humidity;
    }

    public double getWindSpeed() {
        return windSpeed;
    }

    public void setWindSpeed(double windSpeed) {
        this.windSpeed = windSpeed;
    }

    public String getCropStatus() {
        return cropStatus;
    }

    public void setCropStatus(String cropStatus) {
        this.cropStatus = cropStatus;
    }

    public String getDataSource() {
        return dataSource;
    }

    public void setDataSource(String dataSource) {
        this.dataSource = dataSource;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    @Override
    public String toString() {
        return "环境数据 [来源=" + dataSource + "]:\n" +
               "  土壤湿度: " + soilMoisture + "%\n" +
               "  土壤pH值: " + soilPH + "\n" +
               "  土壤养分: " + soilNutrient + "\n" +
               "  温度: " + temperature + "°C\n" +
               "  空气湿度: " + humidity + "%\n" +
               "  风速: " + windSpeed + "m/s\n" +
               "  作物状态: " + cropStatus;
    }
}